/*
 * @Description:
 * @Version: 1.0
 * @Autor: liujun
 * @Date: 2020-10-10 11:56:05
 * @LastEditors: liujun
 * @LastEditTime: 2020-12-16 10:06:40
 */
import Vue from "vue";
import Vuex from "vuex";
import common from "./common";
import request from "@/api";
Vue.use(Vuex);

const store = new Vuex.Store({
  state: {
    user: {},
    modules: null,
    producttype:'',
    numberList:[],
    groupInfo:{},
    waitPayCount:0,
    waitAuditCount:0,
    messageType:'',
    messageProduct:'',
  },
  mutations: {
    setUser(state, user) {
      state.user = user;
    },
    setModules(state, modules) {
      state.modules = modules;
    },
    setProductType(state, ProductType) {
      state.producttype = ProductType;
    },
    setNumberList(state,numberList){
    	state.numberList=numberList
    },
    setGroupInfo(state,groupInfo){
    	state.groupInfo=groupInfo
    },
    setWaitPayCount(state){
    	request.getWaitPayCount()
		.then(res=>{
			if(res.code==0){
				state.waitPayCount=res.penddingnum
			}
		})
    },
    setWaitAuditCount(state){
    	request.getWaitAuditCount()
		.then(res=>{
			if(res.code==0){
				state.waitAuditCount=res.num
			}
		})
    },
    setMessageType(state,messageType){
    	state.messageType=messageType
    },
    setMessageProduct(state,messageProduct){
    	state.messageProduct=messageProduct
    }
  },
  modules: {
    common
  }
});

export default store;
